package org.aom.util;

import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;

import org.aom.constants.Constants;

public class BundleUtil {
	private static Locale locale = Constants.LOCALE;

	public static String getLocalizedMessage(String key) {
		String bundleName = Constants.RESOURCE_FILE;
		ResourceBundle rb = ResourceBundle.getBundle(bundleName, locale);
		return rb.getString(key);
	}

	public static String getLocalizedMessage(String key, String[] params) {
		String rawString = getLocalizedMessage(key);
		MessageFormat format = new MessageFormat(rawString);
		return format.format(params);
	}

}
